package com.hengxinguotong.zhihuichengjian.ui.quality;

import android.app.AlertDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;

import com.google.gson.Gson;
import com.hengxinguotong.zhihuichengjian.R;
import com.hengxinguotong.zhihuichengjian.adapter.AccidentAddPersonAdapter;
import com.hengxinguotong.zhihuichengjian.adapter.AualityTestAddPicAdapter;
import com.hengxinguotong.zhihuichengjian.bean.AddGroupPersonnelListRes;
import com.hengxinguotong.zhihuichengjian.bean.Quality;
import com.hengxinguotong.zhihuichengjian.bean.QualityListRes;
import com.hengxinguotong.zhihuichengjian.bean.SafetyBean;
import com.hengxinguotong.zhihuichengjian.bean.SafetyRes;
import com.hengxinguotong.zhihuichengjian.bean.Structure;
import com.hengxinguotong.zhihuichengjian.bean.StructureListRes;
import com.hengxinguotong.zhihuichengjian.bean.User;
import com.hengxinguotong.zhihuichengjian.picturebrowser.view.TaskBigImgActivity;
import com.hengxinguotong.zhihuichengjian.ui.BaseActivity;
import com.hengxinguotong.zhihuichengjian.utils.Constants;
import com.hengxinguotong.zhihuichengjian.utils.FileUtil;
import com.hengxinguotong.zhihuichengjian.utils.SPUtil;
import com.hengxinguotong.zhihuichengjian.utils.Utils;
import com.hengxinguotong.zhihuichengjian.widget.font.HXEditTextView;
import com.hengxinguotong.zhihuichengjian.widget.font.HXTextView;
import com.hengxinguotong.zhihuichengjian.widget.view.MyStructureTreeView;
import com.hengxinguotong.zhihuichengjian.widget.view.MyTreeView;
import com.lidroid.xutils.http.RequestParams;

import org.apache.http.entity.StringEntity;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import me.nereo.multi_image_selector.MultiImageSelector;
import me.nereo.multi_image_selector.MultiImageSelectorActivity;

/**
 * 整改详情
 * Created by liux on 2017/3/7.
 */

public class RectificationActivity extends BaseActivity implements AualityTestAddPicAdapter.OnRecyclerViewClickListener {
    @BindView(R.id.tv_title_name)
    HXTextView tvTitleName;
    @BindView(R.id.iv_back)
    HXTextView ivBack;
    @BindView(R.id.save_test)
    HXTextView saveTest;
    @BindView(R.id.rl_title)
    RelativeLayout rlTitle;
    @BindView(R.id.info_ll)
    LinearLayout infoLl;
    @BindView(R.id.state_tv)
    HXTextView stateTv;
    @BindView(R.id.info_tv)
    HXTextView infoTv;
    @BindView(R.id.rectification_time)
    HXTextView rectificationTime;
    @BindView(R.id.check_date_rl)
    RelativeLayout checkDateRl;
    @BindView(R.id.order_no_tv)
    HXTextView orderNoTv;
    @BindView(R.id.order_no_rl)
    RelativeLayout orderNoRl;
    @BindView(R.id.structure_tv)
    HXTextView structureTv;
    @BindView(R.id.structure_rl)
    RelativeLayout structureRl;
    @BindView(R.id.structure_title_rl)
    RelativeLayout structureTitleRl;
    @BindView(R.id.company_tv)
    HXTextView companyTv;
    @BindView(R.id.team_tv)
    HXTextView teamTv;
    @BindView(R.id.contacts_tv)
    HXTextView contactsTv;
    @BindView(R.id.contacts_moblie_tv)
    HXTextView contactsMoblieTv;
    @BindView(R.id.person_number)
    HXTextView personNumber;
    @BindView(R.id.no_notice_tv)
    HXTextView noNoticeTv;
    @BindView(R.id.add_notice_rv)
    RecyclerView addNoticeRv;
    @BindView(R.id.select_ll)
    LinearLayout selectLl;
    @BindView(R.id.result_rl)
    RelativeLayout resultRl;
    @BindView(R.id.test_project_tv)
    HXTextView testProjectTv;
    @BindView(R.id.test_project_etv)
    HXEditTextView testProjectEtv;
    @BindView(R.id.test_result_etv)
    HXEditTextView testResultEtv;
    @BindView(R.id.no_pic_tv)
    HXTextView noPicTv;
    @BindView(R.id.pic_rv)
    RecyclerView picRv;
    @BindView(R.id.remark_etv)
    HXEditTextView remarkEtv;
    @BindView(R.id.add_pic_rv)
    RecyclerView addPicRv;
    @BindView(R.id.histroy_ll)
    LinearLayout histroyLl;
    @BindView(R.id.pass)
    RadioButton pass;
    @BindView(R.id.notpass)
    RadioButton notpass;
    @BindView(R.id.result_rg)
    RadioGroup resultRg;
    @BindView(R.id.result_ll)
    LinearLayout resultLl;
    @BindView(R.id.pic_ll)
    LinearLayout picLl;
    @BindView(R.id.rectify_time)
    HXTextView rectifyTime;
    @BindView(R.id.test_rectify_etv)
    HXEditTextView testRectifyEtv;
    @BindView(R.id.correct_remark_etv)
    HXEditTextView correctRemarkEtv;
    @BindView(R.id.remark_ll)
    LinearLayout remarkLl;
    private AualityTestAddPicAdapter picAdapter;
    private AualityTestAddPicAdapter addPicAdapter;
    private AualityTestAddPicAdapter historyAdapter;
    private List<String> paths;
    private List<String> addPaths;
    private List<String> minPaths;
    private AlertDialog dialog;
    private int year = 0;
    private int monthOfYear = 0;
    private int dayOfMonth = 0;
    private Quality quality;
    private int type = 1;
    private ViewHolder viewHolder;
    private List<User> noticedPersons;//告知人员数组
    private AccidentAddPersonAdapter noticedAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        type = getIntent().getIntExtra("type", Constants.QUALITY);
        setContentView(R.layout.activity_rectification);
        ButterKnife.bind(this);
        initView();
        getRectificationHistory();
    }


    private void initView() {
        quality = (Quality) getIntent().getSerializableExtra("quality");
        if (quality == null) {
            finish();
            showToast("该条信息不存在");
            return;
        }
        switch (type){
            case Constants.QUALITY:
            case Constants.QUALITY_SUPERVISE:
                tvTitleName.setText("质量整改详情");
                break;
            case Constants.SECURITY:
                tvTitleName.setText("安全整改详情");
                break;
            case Constants.LIVE:
                tvTitleName.setText("现场整改详情");
                break;
        }
        if(!Utils.isEmpty(quality.getOrderNo())){
            orderNoRl.setVisibility(View.VISIBLE);
            orderNoTv.setText(quality.getOrderNo());
        }else{
            orderNoRl.setVisibility(View.GONE);
        }
        getUserList(quality.getId());//获取告知人列表
        getpProjectStructureList(quality.getId());//获取检查部位列表
        switch (quality.getCorrectiveStatus()) {
            case 1:
                if (SPUtil.getString(this, "userId").equals(quality.getContactId())) {
                    saveTest.setVisibility(View.VISIBLE);
                    picLl.setVisibility(View.VISIBLE);
                    remarkLl.setVisibility(View.VISIBLE);
                }
                stateTv.setText("待整改");
                stateTv.setTextColor(getResources().getColor(R.color.color_1294db));
                break;
            case 3:
                if (SPUtil.getString(this, "userId").equals(quality.getContactId())) {
                    saveTest.setVisibility(View.VISIBLE);
                    picLl.setVisibility(View.VISIBLE);
                    remarkLl.setVisibility(View.VISIBLE);
                }
                stateTv.setText("复检不通过");
                stateTv.setTextColor(getResources().getColor(R.color.color_ed8d70));
                break;
            case 2:
                if (SPUtil.getString(this, "userId").equals(quality.getCreateBy())) {
                    picLl.setVisibility(View.VISIBLE);
                    remarkLl.setVisibility(View.VISIBLE);
                    resultLl.setVisibility(View.VISIBLE);
                    saveTest.setVisibility(View.VISIBLE);
                }
                stateTv.setText("待复检");
                stateTv.setTextColor(getResources().getColor(R.color.color_978cff));
                break;
            case 4:
                stateTv.setText("已整改");
                stateTv.setTextColor(getResources().getColor(R.color.color_71e5a2));
                break;
        }
        checkDateRl.setEnabled(false);
        rectificationTime.setText(quality.getBusinessDate());
        LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        testProjectEtv.setLayoutParams(params);
        testResultEtv.setLayoutParams(params);
        testRectifyEtv.setLayoutParams(params);
        remarkEtv.setLayoutParams(params);
        rectificationTime.setText(quality.getCorrectiveCompletionDate());
        Utils.setEditTextViewUnable("", testProjectTv);
        getResultList(quality.getId());//获取项目检查及结果列表
        Utils.setEditTextViewUnable(quality.getResults(), testResultEtv);
        Utils.setEditTextViewUnable(quality.getCorrectiveCompletionDate(), rectifyTime);
        Utils.setEditTextViewUnable(quality.getCorrectiveRequest(), testRectifyEtv);
        Utils.setEditTextViewUnable(quality.getProjectStructureName(), structureTv);
        Utils.setEditTextViewUnable(quality.getProjectCompanyName(), companyTv);
        Utils.setEditTextViewUnable(quality.getTeamName(), teamTv);
        Utils.setEditTextViewUnable(quality.getContactName(), contactsTv);
        Utils.setEditTextViewUnable(quality.getContactMobile(), contactsMoblieTv);
        Utils.setEditTextViewUnable(quality.getRemark(), remarkEtv);
        if (quality.getPicList().size() == 0) {
            noPicTv.setVisibility(View.VISIBLE);
            picRv.setVisibility(View.GONE);
        } else {
            picRv.setLayoutManager(getLinearLayoutManager());
            paths = quality.getPicList();
            picAdapter = new AualityTestAddPicAdapter(this, paths, new AualityTestAddPicAdapter.OnRecyclerViewClickListener() {
                @Override
                public void onItemClick(View v, int position) {
                    TaskBigImgActivity.startActivity(RectificationActivity.this, (ArrayList<String>) paths, position);
                }

                @Override
                public void onClick(View v) {

                }
            }, false);
            picRv.setAdapter(picAdapter);
        }


        addPicRv.setLayoutManager(getLinearLayoutManager());
        addPaths = new ArrayList<String>();
        addPaths.add(Utils.ADDPIC);
        addPicAdapter = new AualityTestAddPicAdapter(this, addPaths, this, true);
        addPicRv.setAdapter(addPicAdapter);
    }

    private void getpProjectStructureList(String qualityId) {
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("constructionId", SPUtil.getString(this, "constructionid"));
            jsonObject.put("inspectionId", qualityId);
        } catch (JSONException e) {
            e.printStackTrace();
        }

        RequestParams params = new RequestParams();
        params.addHeader("Content-type", "application/json");
        try {
            params.setBodyEntity(new StringEntity(jsonObject.toString(), "UTF-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        Utils.requestData(null, this, "/inspection/queryInspectionProjectStructure/" + SPUtil.getString(this, "uuid"), params, new Utils.ListenerJson() {
            @Override
            public void onSuccess(String json) {
                if (!Utils.isEmpty(json)) {
                    Gson gson = new Gson();
                    StructureListRes structureListRes = gson.fromJson(json, StructureListRes.class);
                    if(structureListRes.getStatus() == 1){
                        processProjectStructure(structureListRes.getValue());
                    }else{
                        showToast(structureListRes.getMsg());
                    }
                }
            }

            @Override
            public void onFailure(String json) {

            }
        });
    }

    private void processProjectStructure(List<Structure> structures){
        MyStructureTreeView mySelectTreeView = new MyStructureTreeView(this);
        mySelectTreeView.setDatas(structures);
        structureRl.removeAllViews();
        structureRl.addView(mySelectTreeView);
    }

    private void getUserList(String securityId) {

        Utils.requestData(null, this, "/inspection/queryNotifyByInspectionId/" + SPUtil.getString(this, "uuid") + "?id=" + securityId, null, new Utils.ListenerJson() {
            @Override
            public void onSuccess(String json) {
                if (!Utils.isEmpty(json)) {
                    Gson gson = new Gson();
                    AddGroupPersonnelListRes personnelListRes = gson.fromJson(json, AddGroupPersonnelListRes.class);
                    if(personnelListRes.getStatus() == 1){
                        processNoticers(personnelListRes.getValue());
                    }else{
                        showToast(personnelListRes.getMsg());
                    }
                }
            }

            @Override
            public void onFailure(String json) {

            }
        });
    }

    private void getResultList(String qualityId) {
        RequestParams params = new RequestParams();
        params.addBodyParameter("constructionId", SPUtil.getString(this, "constructionid"));
        params.addBodyParameter("type", quality.getType() + "");

        Utils.requestData(null, this, "/inspection/constructionSafe/queryResultByInspectionId/" + SPUtil.getString(this, "uuid") + "?id=" + qualityId, params, new Utils.ListenerJson() {
            @Override
            public void onSuccess(String json) {
                if (!Utils.isEmpty(json)) {
                    Gson gson = new Gson();
                    SafetyRes safetyRes = gson.fromJson(json, SafetyRes.class);
                    if(safetyRes.getStatus() == 1){
                        if(null != safetyRes.getValue() && safetyRes.getValue().size() > 0){
                            processResults(safetyRes.getValue());
                        }
                    }else{
                        showToast(safetyRes.getMsg());
                    }
                }
            }

            @Override
            public void onFailure(String json) {

            }
        });
    }

    private void processResults(List<SafetyBean> resultList){
        if(null == resultList || resultList.size() <= 0){
            selectLl.setVisibility(View.GONE);
            Utils.setEditTextViewUnable(quality.getItems(), testProjectEtv);
        }else{
            MyTreeView myTreeView = new MyTreeView(this);
            myTreeView.setDatas(resultList);
            resultRl.removeAllViews();
            resultRl.addView(myTreeView);

            if(Utils.isEmpty(quality.getOtherItems())){
                if(!Utils.isEmpty(quality.getItems())){
                    String[] items = quality.getItems().split(",");
                    if(items.length <= getLeafCount(resultList)){
                        Utils.setEditTextViewUnable("", testProjectEtv);
                    }else{
                        String item = items[items.length - 1];
                        Utils.setEditTextViewUnable(item, testProjectEtv);
                    }
                }else{
                    Utils.setEditTextViewUnable("", testProjectEtv);
                }
            }else{
                Utils.setEditTextViewUnable(quality.getOtherItems(), testProjectEtv);
            }
        }
    }

    int count = 0;
    private int getLeafCount(List<SafetyBean> leafDatas){
        for (SafetyBean safetyBean:leafDatas){
            if(safetyBean.getData().size() <= 0){
                count++;
            }else{
                getLeafCount(safetyBean.getData());
            }
        }
        return count;
    }

    private void processNoticers(final List<User> noticers){
        if (noticers.size() == 0) {
            noNoticeTv.setVisibility(View.VISIBLE);
        } else {
            noticedAdapter = new AccidentAddPersonAdapter(this, noticers, new AccidentAddPersonAdapter.OnRecyclerViewClickListener() {
                @Override
                public void onItemClick(View v, int position) {
//                    Intent intent = new Intent(RectificationActivity.this, AddPersonnelActivity.class);
//                    intent.putExtra("type", AddPersonnelActivity.MODTYPE);
//                    intent.putExtra("personId", noticers.get(position).getPersonId());
//                    startActivity(intent);
                }

                @Override
                public void onClick(View v) {

                }
            }, false);
            addNoticeRv.setLayoutManager(getLinearLayoutManager());
            addNoticeRv.setAdapter(noticedAdapter);
            personNumber.setText("已选择" + noticers.size() + "人");
        }
    }

    @OnClick({R.id.iv_back, R.id.save_test, R.id.info_rl})
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.iv_back:
                finish();
                break;
            case R.id.save_test:
                getMinImage();
                break;
            case R.id.info_rl:
                if(infoLl.isShown()){
                    infoLl.setVisibility(View.GONE);
                    infoTv.setText("基本信息（信息已折叠，点击展开）");
                }else{
                    infoLl.setVisibility(View.VISIBLE);
                    infoTv.setText("基本信息（信息已展开，点击折叠）");
                }
                break;
        }
    }


    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }


    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == 1 && data != null) {
            addPaths = data.getStringArrayListExtra(MultiImageSelectorActivity.EXTRA_RESULT);
            addPaths.add(Utils.ADDPIC);
            if (addPicAdapter != null) {
                addPicAdapter.setPaths(addPaths);
            }
        }
    }

    @Override
    public void onItemClick(View v, int position) {
        Intent intent;
        if (addPaths.get(position).equals(Utils.ADDPIC)) {
            List<String> tempStrings = new ArrayList<String>();
            tempStrings.addAll(addPaths);
            tempStrings.remove(tempStrings.size() - 1);
            MultiImageSelector.create()
                    .showCamera(true) // show camera or not. true by default_grey
                    .count(9) // max select image size, 9 by default_grey. used width #.multi()
                    .multi()
                    .origin((ArrayList<String>) tempStrings)
                    .start(this, 1);
        } else {
            addPaths.remove(position);
            addPicAdapter.notifyDataSetChanged();
        }
    }


    private void submitRectification() {
        RequestParams params = new RequestParams();
        params.addBodyParameter("inspectionId", quality.getId());
        params.addBodyParameter("personId", SPUtil.getString(this, "userId"));
        switch (quality.getCorrectiveStatus()) {
            case 1:
            case 3:
                params.addBodyParameter("correctiveStatus", "2");
                break;
            case 2:
                if (resultRg.getCheckedRadioButtonId() == -1) {
                    showToast("请选择处理结果");
                    return;
                }
                if (resultRg.getCheckedRadioButtonId() == R.id.pass) {
                    params.addBodyParameter("correctiveStatus", "4");
                } else if (resultRg.getCheckedRadioButtonId() == R.id.notpass) {
                    params.addBodyParameter("correctiveStatus", "3");
                }
                break;
        }
        params.addBodyParameter("remark", correctRemarkEtv.getEditableText().toString());
        if(minPaths.size() > 0){
            for (int i = 0; i < minPaths.size(); i++) {
                params.addBodyParameter("files[" + i + "]", new File(minPaths.get(i)));
            }
        }

        Utils.requestData(getResources().getString(R.string.loading), this, "/inspection/saveCorrectiveProcess/" + SPUtil.getString(this,"uuid"), params, new Utils.ListenerJson() {
            @Override
            public void onSuccess(String json) {
                try {
                    JSONObject object = new JSONObject(json);
                    String msg = object.getString("msg");
                    int status = object.getInt("status");
                    if(status == 1){
                        showToast("提交成功");
                        setResult(RectificationListActivity.UPDATE);
                        finish();
                    }else{
                        showToast(msg);
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }

            @Override
            public void onFailure(String json) {
                try {
                    JSONObject object = new JSONObject(json);
                    String msg = object.getString("msg");
                    showToast(msg);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });

    }


    private LinearLayoutManager getLinearLayoutManager() {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
        linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
        return linearLayoutManager;
    }

    private void getMinImage() {
        if (addPaths.size() > 1) {
            Utils.startDownload(getResources().getString(R.string.loading), this);

            new AsyncTask<Void, Void, Void>() {
                @Override
                protected Void doInBackground(Void... voids) {
                    minPaths = new ArrayList<String>();
                    for (int i = 0; i < addPaths.size() - 1; i++) {
                        String path = FileUtil.imageDir1 + System.currentTimeMillis() + ".jpg";
                        FileUtil.writeByteArrayToPath(path, FileUtil.handleUploadImg(addPaths.get(i)));
                        minPaths.add(path);
                    }
                    return null;
                }


                @Override
                protected void onPostExecute(Void aVoid) {
                    submitRectification();
                }


            }.execute();
        } else {
            minPaths = new ArrayList<String>();
            submitRectification();
        }
    }


    private void getRectificationHistory() {
        JSONObject jsonObject = new JSONObject();
        try {
            jsonObject.put("inspectionId", quality.getId());
            jsonObject.put("pageNum", "1");
            jsonObject.put("pageSize", "100");
        } catch (JSONException e) {
            e.printStackTrace();
        }

        RequestParams params = new RequestParams();
        params.addHeader("Content-type", "application/json");
        try {
            params.setBodyEntity(new StringEntity(jsonObject.toString(), "UTF-8"));
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        Utils.requestData(null, this, "/inspection/queryCorrectiveProcessList/" + SPUtil.getString(this,"uuid"), params, new Utils.ListenerJson() {
            @Override
            public void onSuccess(String json) {
                if (!Utils.isEmpty(json)) {
                    Gson gson = new Gson();
                    QualityListRes groupListRes = gson.fromJson(json, QualityListRes.class);
                    for (final Quality _Quality :
                            groupListRes.getValue()) {
                        View convertView = LayoutInflater.from(RectificationActivity.this)
                                .inflate(R.layout.item_submit_task, null, false);
                        viewHolder = new ViewHolder(convertView);
                        viewHolder.data.setText(_Quality.getCreateTime());
                        viewHolder.name.setText(_Quality.getCreateBy());
                        if(!Utils.isEmpty(_Quality.getRemark())){
                            viewHolder.remarkTv.setText(_Quality.getRemark());
                        }
                        switch (_Quality.getCorrectiveStatus()){
                            case 1:
                                viewHolder.stateTv.setText("提交整改");
                                viewHolder.stateTv.setTextColor(getResources().getColor(R.color.color_71e5a2));
                                viewHolder.stateIv.setImageResource(R.mipmap.already_confirmed);
                                break;
                            case 2:
                                viewHolder.stateTv.setText("提交复检");
                                viewHolder.stateIv.setImageResource(R.mipmap.already_confirmed);
                                viewHolder.stateTv.setTextColor(getResources().getColor(R.color.color_71e5a2));
                                break;
                            case 3:
                                viewHolder.stateTv.setText("复检不通过");
                                viewHolder.stateTv.setTextColor(getResources().getColor(R.color.color_f1636a));
                                viewHolder.stateIv.setImageResource(R.mipmap.canceled);
                                break;
                            case 4:
                                viewHolder.stateTv.setText("整改通过");
                                viewHolder.stateIv.setImageResource(R.mipmap.already_confirmed);
                                viewHolder.stateTv.setTextColor(getResources().getColor(R.color.color_71e5a2));
                                break;
                        }

                        historyAdapter = new AualityTestAddPicAdapter(RectificationActivity.this, _Quality.getPicList(), new AualityTestAddPicAdapter.OnRecyclerViewClickListener() {
                            @Override
                            public void onItemClick(View v, int position) {
                                TaskBigImgActivity.startActivity(RectificationActivity.this, (ArrayList<String>) _Quality.getPicList(), position);
                            }

                            @Override
                            public void onClick(View v) {

                            }
                        }, false);
                        viewHolder.picRv.setLayoutManager(getLinearLayoutManager());
                        viewHolder.picRv.setAdapter(historyAdapter);
                        histroyLl.addView(convertView);
                    }
                    histroyLl.setVisibility(View.VISIBLE);

                }
            }

            @Override
            public void onFailure(String json) {
            }
        });
    }

    static class ViewHolder {
        @BindView(R.id.state_iv)
        ImageView stateIv;
        @BindView(R.id.state_tv)
        HXTextView stateTv;
        @BindView(R.id.remark_tv)
        HXTextView remarkTv;
        @BindView(R.id.pic_rv)
        RecyclerView picRv;
        @BindView(R.id.name)
        HXTextView name;
        @BindView(R.id.data)
        HXTextView data;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
